Skip to content

feat: Add CRUD log messages #1005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Aug 15, 2024
Merged

Conversation

zkayyali812
Copy link
Collaborator

@zkayyali812 zkayyali812 commented Aug 13, 2024

Description: Adds CRUD logging messages to core EDA resources.
Jira: https://issues.redhat.com/browse/AAP-29258

Rulebook Activations Logging added for following operations-

  1. Create
  2. Read
  3. Update
  4. Delete
  5. ListActivations
  6. Enable
  7. Disable
  8. Restart

Decision Environments Logging added for following operations-

  1. Create
  2. Read
  3. Update
  4. Delete

Project Logging added for following operations-

  1. Create
  2. Read
  3. Update
  4. Delete
  5. Sync

EventStreams Logging added for following operations -

  1. Create
  2. Read
  3. Update
  4. Delete
  5. List
  6. ListActivations

Rulebook Activation Start/Stop/Restart (Already exists)

  1. Activation Start
    1. Has many log messsages including various statuses an activation may hit
  2. Activation Stop
  3. Activation Restart
  4. Activation Delete

@zkayyali812 zkayyali812 marked this pull request as ready for review August 14, 2024 15:08
@zkayyali812 zkayyali812 requested a review from a team as a code owner August 14, 2024 15:08
@zkayyali812 zkayyali812 changed the title feat: Add CRUD log messages (WIP) feat: Add CRUD log messages Aug 14, 2024
@mkanoor
Copy link
Contributor

mkanoor commented Aug 14, 2024

@zkayyali812 Would it be possible to use a separate package like this one https://github.com/jjkester/django-auditlog

@zkayyali812
Copy link
Collaborator Author

@mkanoor
Preferably for event 1, we should keep this change simple to avoid any potential changes to our downstream build.
For this reason, this PR uses just the simple logger.

I expect if we used an alternate library here, there could be potential of downstream impact.
For event 2 the plan is to revisit this to implement a more robust logging/auditing solution.

@zkayyali812 zkayyali812 added the 3ci-debug Builds images and dev deployment label Aug 14, 2024
@zkayyali812
Copy link
Collaborator Author

e2e tests now pass without read enabled. Will test again with read enabled.

dhaustein
dhaustein previously approved these changes Aug 15, 2024
Copy link
Contributor

@ttuffin ttuffin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we include the resource ID in the logs as well? It is possible to ascertain the ID from the previous call to the API, as long as the server is not processing parallel requests. For example:

eda-api-1                      | 2024-08-15 01:20:22,789 django.channels.server INFO     HTTP GET /api/eda/v1/projects/1/ 200 [0.19, 172.18.0.1:34558]
eda-api-1                      | 2024-08-15 01:20:23,550 aap_eda.api.views.project INFO     Action: Read / ResourceType: Project / ResourceName: QE-project 1YuqSVFtgHfJzROfvtCV4 / Organization: Default

But on a busy server that it processing many requests in parallel this will become difficult, e.g:

eda-api-1                      | 2024-08-15 01:20:26,326 django.channels.server INFO     HTTP GET /api/eda/v1/activations/1/ 200 [0.31, 172.18.0.1:34558]
eda-api-1                      | 2024-08-15 01:20:26,328 django.channels.server INFO     HTTP GET /api/eda/v1/activations/2/ 200 [0.30, 172.18.0.1:33632]
eda-api-1                      | 2024-08-15 01:20:26,961 aap_eda.api.views.activation INFO     Action: Read / ResourceType: RulebookActivation / ResourceName: QE-activation-batch---1a2AdC34aba3BbaBAb2c4 / Organization: Default

Including the ID in the CRUD logs will make it clear.

Copy link

@ttuffin ttuffin requested a review from a team August 15, 2024 13:07
@zkayyali812 zkayyali812 merged commit 86dbe2c into ansible:main Aug 15, 2024
6 checks passed
@zkayyali812 zkayyali812 deleted the zk/simple/logging branch August 15, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3ci-debug Builds images and dev deployment run-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants